package com.ruyuan.commodity.consumer.core.consumer.goodssearch;

import com.ruyuan.commodity.consumer.api.GoodsWordsFeignClient;
import com.ruyuan.commodity.consumer.core.event.GoodsWordsChangeEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * 变更商品提示词中商品数量
 */
@Service
public class GoodsWordsChangeConsumer implements GoodsWordsChangeEvent {

    @Autowired
    private GoodsWordsFeignClient goodsWordsFeignClient;


    @Override
    public void wordsChange(String words) {
        if(!StringUtils.isEmpty(words)) {
            // 根据提示词更新提示词下商品数量
            goodsWordsFeignClient.updateGoodsNum(words);
        }
    }
}
